/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    2013 year
 *    Author: Esipenko Aleksey (Alexorleon)
 *    E-Mail: alexorleon@gmail.com
 */
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include <QPushButton>

SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);

    ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Отмена"));
}

SettingsDialog::~SettingsDialog()
{
    delete ui;
}

void SettingsDialog::setParameters(const QList<int> &list){

    ui->spTop->setValue(list.at(0));
    ui->spLeft->setValue(list.at(1));
    ui->spRight->setValue(list.at(2));
    ui->spButton->setValue(list.at(3));

    ui->spDP->setValue(list.at(4));
    ui->spQRText->setValue(list.at(5));
    ui->spHeaders->setValue(list.at(6));
    ui->spTable->setValue(list.at(7));
    ui->spHistory->setValue(list.at(8));
}

QList<int> SettingsDialog::getParameters() const{

    QList<int> parameters;

    // границы
    parameters.append(ui->spTop->value());
    parameters.append(ui->spLeft->value());
    parameters.append(ui->spRight->value());
    parameters.append(ui->spButton->value());

    // шрифт
    parameters.append(ui->spDP->value());
    parameters.append(ui->spQRText->value());
    parameters.append(ui->spHeaders->value());
    parameters.append(ui->spTable->value());
    parameters.append(ui->spHistory->value());

    return parameters;
}
